package com.zyb.qiyu.user.provider.config;


import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.ApplicationRunner;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import javax.sql.DataSource;
import java.sql.Connection;

/**
 * @ClassName ShardingJDBCDatasourceConfig
 * @Author zhaoyb
 * @Date 2024-08-01
 * @Version 1.0
 */
@Configuration
public class ShardingJDBCDatasourceConfig {
    private static  final Logger LOGGER= LoggerFactory.getLogger(ShardingJDBCDatasourceConfig.class);
    @Bean
    public ApplicationRunner runner(DataSource dataSource){
        return args -> {
            LOGGER.info("datasource:{}",dataSource);
            //手动触发下连接池的连接创建
            Connection connection = dataSource.getConnection();
        };
    }

}
